{%extends 'layout.html'%}

{%block link%}

<link rel="stylesheet" href="../../public/js/codeShow/prism.css" />{%endblock%}
{%block body%}

    <div class="doc-container" id="doc-container">
        <div class="container-fixed">
            <div class="col-content" style="width:100%">
                <div class="inner">
                    <article class="article-list">
                        <input type="hidden" value="@Model.BlogTypeID" id="blogtypeid" />
                        <section class="article-item">
                            <aside class="title" style="line-height:1.5;">
                                <h4>{{blog.title}}</h4>
                                <input id ="blogId" hidden value={{blog._id.toString()}}>
                                <p class="fc-grey fs-14">
                                    <small>
                                        作者：<a href="javascript:void(0)" target="_blank" class="fc-link">{{blog.author}}</a>
                                    </small>
                                    <small class="ml10">阅读量：<i class="readcount">{{blog.reading}}</i></small>
                                    <small class="ml10">创建于 <label>{{blog.created|date('Y-m-d H:i',8*-60)}}</label> </small>
                                </p>
                            </aside>
                            <div class="time mt10" style="padding-bottom:0;">
                                <span class="day">{{blog.created|date('d')}}</span>
                                <span class="month fs-18">{{blog.created|date('m')}}<small class="fs-14">月</small></span>
                                <span class="year fs-18">{{blog.created|date('Y')}}</span>
                            </div>
                            <textarea id="content" hidden>{{blog.content}}</textarea>

                            <div style="padding: 20px;word-break: break-all"  id = ''></div>
                            <div  class="content artiledetail" style="border-bottom: 1px solid #e1e2e0; padding-bottom: 20px;">
                                <div class="copyright mt20">
                                    <div style="padding: 20px;word-break: break-all"  id = 'cp'></div>
                                </div>
                            </div>


                            <div  class="content artiledetail" style="border-bottom: 1px solid #e1e2e0; padding-bottom: 20px;">
                                <div class="copyright mt20">
                                    <p class="f-toe fc-black">
                                        本文版权归 Megumin 所有，转载请注明出处.
                                    </p>
                                    <p class="f-toe">
                                        本文标题：{{blog.title}}
                                        <a href="javascript:void(0)" class="r-title"></a>
                                    </p>
                                </div>
                                <div id="aplayer" style="margin:5px 0"></div>
                                <h6>  <div class="bshare-custom icon-medium">
                                    <a title="分享到QQ空间" class="bshare-qzone"></a>
                                    <a title="分享到新浪微博" class="bshare-sinaminiblog"></a>
                                    <a title="分享到人人网" class="bshare-renren"></a>
                                    <a title="分享到腾讯微博" class="bshare-qqmb"></a>
                                    <a title="分享到网易微博" class="bshare-neteasemb"></a>
                                    <a title="更多平台" class="bshare-more bshare-more-icon more-style-addthis"></a>
                                    <span class="BSHARE_COUNT bshare-share-count">0</span></div>
                                </h6>
                                <ol class="b-relation"></ol>
                            </div>
                            <!--友情链接-->
                            <div class="bdsharebuttonbox share" data-tag="share_1">
                                <p id ="like" class="like" class="cs" >&#9733;</p>
                               <!-- <ul>
                                    <li class="f-praise"><span><a class="s-praise"></a></span></li>
                                    <li class="f-weinxi"><a class="s-weinxi" data-cmd="weixin"></a></li>
                                    <li class="f-sina"><a class="s-sina" data-cmd="tsina"></a></li>
                                    <li class="f-qq" href="#"><i class="fa fa-qq"></i></li>
                                    <li class="f-qzone"><a class="s-qzone" data-cmd="qzone"></a></li>
                                </ul>-->
                            </div>
                            <div class="f-cb"></div>
                            <div class="mt20 f-fwn fs-24 fc-grey comment" style="border-top: 1px solid #e1e2e0; padding-top: 20px;">
                            </div>
                            <fieldset class="layui-elem-field layui-field-title">
                                <legend>发表评论</legend>
                                <div class="layui-field-box">
                                    <div class="leavemessage" style="text-align:initial">
                                        <form class="layui-form blog-editor" action="">
                                            <input type="hidden" name="articleid" id="articleid" value="@Model.ID">
                                            <div class="layui-form-item">
                                                <textarea name="editorContent" lay-verify="content" id="remarkEditor" placeholder="请输入内容" class="layui-textarea layui-hide"></textarea>
                                            </div>
                                            <div class="layui-form-item">
                                                <button class="layui-btn" lay-submit="formLeaveMessage" lay-filter="formLeaveMessage">提交留言</button>

                                            </div>
                                            <a class="layui-btn layui-btn-fluid" href="/blog" lay-submit="formLeaveMessage" lay-filter="formLeaveMessage">返回</a>
                                        </form>
                                    </div>
                                </div>
                            </fieldset>
                            <ul class="blog-comment" id="blog-comment"></ul>
                        </section>
                    </article>
                </div>
            </div>
        </div>
    </div>
{%endblock%}
    {%block script%}
<script src="../../public/js/tinymce/tinymce.min.js" referrerpolicy="origin"></script>
    <script type="text/javascript" charset="utf-8" src="http://static.bshare.cn/b/buttonLite.js#style=-1&amp;uuid=&amp;pophcol=2&amp;lang=zh">
    </script><script type="text/javascript" charset="utf-8" src="http://static.bshare.cn/b/bshareC0.js"></script>
    <script>
        $(function(){
            let $like = $("#like");
            let $blogId =$("#blogId");
            let $content = $("#content");
            let $cp =$('#cp');
            $cp.html("<pre>"+$content.val()+"</pre>")
            //$content.html(res.blog.content())
            $like.click(function () {
                if(!$like.hasClass("cs")){
                    $(this).addClass('cs');
                    $.ajax({
                        type:'post',
                        url:"/favorites/add",
                        data:{
                            id:$blogId.val(),
                        },
                        success:function (result){
                            alert(result.msg);
                        }
                    })
                }else{
                    $(this).removeClass('cs');
                    $.ajax({
                        type:'post',
                        url:"/favorites/delete",
                        data:{
                            id:$blogId.val(),
                        },
                        success:function (result){
                            alert(result.msg);
                        }
                    })
                }
            })
        })
    </script>

<script src="../../public/js/codeShow/prism.js"></script>
{%endblock%}
